import java.util.*;

public class RecursionTest {
    static public Scanner sc = new Scanner(System.in);

    static public void test(int num) {
        if (num == 0)
            return;

        System.out.printf("%d ", num);
        test(num - 1);
        System.out.printf("%d ", num);
    }

    static public int test1(int num) {
        if (num == 1)
            return 1;
        return num + test1(num -1);
    }

    static public int decToOct(int num) {
        if (num == 0)
            return 0;
        return decToOct(num / 8) * 10 + num % 8;
    }

    static public void main(String [] args) {
        test(10);
        System.out.println();
        System.out.printf("sum = %d\n", test1(10));

        System.out.printf("请输入十进制数字: ");
        int num = sc.nextInt();
        System.out.printf("%d <=> %d\n", num, decToOct(num));
    }
}
